<template>
  <view class="discover-chat">
    <view class="header">
      <text class="title">聊天榜</text>
    </view>
    
    <view class="content">
      <view class="chat-list">
        <view class="chat-item" v-for="(item, index) in chatList" :key="index" @click="goToChat(item)">
          <view class="rank">{{ index + 1 }}</view>
          <view class="avatar">{{ item.avatar }}</view>
          <view class="info">
            <text class="name">{{ item.name }}</text>
            <text class="desc">{{ item.description }}</text>
          </view>
          <view class="stats">
            <text class="count">{{ item.chatCount }}次对话</text>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      chatList: [
        { id: 1, name: '智能助手', avatar: '🤖', description: '通用AI助手，帮你解答各种问题', chatCount: 1250 },
        { id: 2, name: '写作助手', avatar: '✍️', description: '专业写作指导，提升写作水平', chatCount: 980 },
        { id: 3, name: '学习导师', avatar: '📚', description: '个性化学习计划，高效学习', chatCount: 756 },
        { id: 4, name: '创意伙伴', avatar: '💡', description: '激发创意灵感，突破思维局限', chatCount: 634 },
        { id: 5, name: '情感顾问', avatar: '💝', description: '情感问题咨询，心理疏导', chatCount: 521 }
      ]
    }
  },
  
  methods: {
    goToChat(item) {
      // 跳转到聊天页面
      uni.navigateTo({
        url: `/pages/chat-detail/chat-detail?id=${item.id}&name=${item.name}`
      })
    }
  }
}
</script>

<style scoped>
.discover-chat {
  min-height: 100vh;
  background-color: var(--primary-bg);
  padding-bottom: 50px;
}

.header {
  padding: 20px 16px;
  background-color: var(--secondary-bg);
  border-bottom: 1px solid var(--border-color);
}

.title {
  font-size: 28px;
  font-weight: bold;
  color: var(--text-primary);
}

.content {
  padding: 16px;
}

.chat-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-item {
  display: flex;
  align-items: center;
  padding: 16px;
  background-color: var(--secondary-bg);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.chat-item:active {
  background-color: rgba(240, 217, 181, 0.1);
}

.rank {
  width: 32px;
  height: 32px;
  background-color: var(--accent-color);
  color: #333;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 20px;
  margin-right: 16px;
}

.avatar {
  font-size: 36px;
  margin-right: 16px;
}

.info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.name {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
}

.desc {
  font-size: 18px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.stats {
  text-align: right;
}

.count {
  font-size: 16px;
  color: var(--accent-color);
  background-color: rgba(240, 217, 181, 0.1);
  padding: 4px 8px;
  border-radius: 12px;
}
</style>
